package com.jz.community.moduleshoppingguide.neighbor.presenter;

import com.jz.community.basecomm.mvp.BaseLifeCyclePresent;
import com.jz.community.basecomm.net.rxandroid.OnLoadListener;
import com.jz.community.moduleshoppingguide.neighbor.bean.CirclePersonsBean;
import com.jz.community.moduleshoppingguide.neighbor.model.NeighborModel;
import com.jz.community.moduleshoppingguide.neighbor.model.NeighborModelImp;
import com.jz.community.moduleshoppingguide.neighbor.ui.NeighborPersonsView;

public class NeighborPersonsPresenter extends BaseLifeCyclePresent<NeighborPersonsView.View> implements NeighborPersonsView.Presenter {

    private NeighborPersonsView.View view;
    private NeighborModel neighborModel;

    public NeighborPersonsPresenter(NeighborPersonsView.View view) {
        this.view = view;
        this.neighborModel = new NeighborModelImp(view.getContext());
    }


    @Override
    public void initPersons(String circleId, int page, int size) {
        neighborModel.initPersons(circleId, page, size, new OnLoadListener<CirclePersonsBean>() {
            @Override
            public void onSuccess(CirclePersonsBean circlePersonsBean) {
                view.setPersonsData(circlePersonsBean);
            }

            @Override
            public void onFail(String msg, int code) {
                view.showError(msg);

            }
        });
    }

}
